const User = require("../model/learn-user")

async function register(openid) {
    const res = await User.findOne({ openid });
    console.log("查找到用户了吗")
    if (res === null) {
        const newUser = await User.create({
            openid,
            nickName:"微信用户"
        })
        return newUser;
    }else{
        return res;
    }
}
module.exports={
    register
}